// 1.RegExp上的test方法：

const reg1 = /^[0-9a-zA-Z]{3,6}$/g
const s1 = "12ad5"
// console.log(reg1.test("s1"));
const s2 = "456dawva1"
// console.log(reg1.test("s2"));


// 2.String上面的replace和match方法：

const reg2 = /日本|大屠杀|政府/g
const str2 = "在南京大屠杀中犯下罪行，日本政府一直不承认"
// console.log(str2.replace(reg2, "**"));

const reg3 = /[0-9]+/g
const str3 = "dawd55dawfge21gaw51ag2wafwa553153"
// console.log(str3.match(reg3));


const reg4 = /(\d)(?=(\d{3})+$)/g
const str4 = "1234567890"
console.log(str4.replace(reg4, "$1,"));